// 导入
const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')

const adapter = new FileSync('db.json')
// 获取db对象
const db = low(adapter)

// db.defaults({ posts: [], user: {} }).write()
db.get('posts').push({id: 1, title: 'lowdb is awesome'}).write()
db.get('user').push({id: 1, title: 'lowdb is awesome'}).write()
console.log(db.get('posts').value())